package com.proj.dao;

import com.proj.bean.Category;
import com.proj.bean.Goods;
import com.proj.bean.Goodsimg;
import com.proj.bean.Review;
import com.proj.util.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface GoodsDao {

    int add(@Param("goods") Goods goods);

    int del(@Param("id")int id);

    int edit(@Param("goods")Goods goods);

    Goods getById(@Param("id")int id);

    List<Goods> getList(@Param("page") Page page, @Param("text")String text);

    List<Goodsimg> getImgByGoodsid(@Param("goodsid")int goodsid);

    int insertImg(@Param("goodsid") int goodsid,@Param("imgurl") String imgurl);

    int delImgById(@Param("id") int id);

    List<Goods> goodsList(@Param("categoryid") Integer categoryid,@Param("keywords") String keywords);

    int getCount(@Param("text")String text);

    List<Category> getParent(@Param("category_id")int category_id);

    List<Review> reviewlist(@Param("goodsid")int goodsid);

    List<Goodsimg> getimg(@Param("goodsid")int goodsid);

    int addsingletocart(@Param("userid") int userid,@Param("goodsid") int goodsid,@Param("number")int number);

    int ifbought(@Param("userid") int userid,@Param("goodsid") int goodsid);

    int newreview(@Param("review")Review review);

    List<Review> getReviewByUserid(@Param("userid")int userid);

    int delReviewById(@Param("id")int id);

}
